<script>
    $().ready(function(){
        $('.txt_active2').change(function(){
            var active = $(this).val();
             var id = $(this).attr('id');             
             $.ajax({
                type : "GET",
                dataType : "json",
                url : "<?php echo base_url().'admin/photo/change_active_photo'?>",
                data : 'id=' + id + '&active=' + active,
                success : function(result){
                    alert(result.error);
                    return false;
                }
            });
        }); 
        $('select[id=txt_select]').change(function(){
            var id = $(this).val();
            $.ajax({
                type : "GET",
                dataType : "html",
                url : "<?php echo base_url().'admin/photo/ajax_photo'?>",
                data : 'id=' + id,
                success : function(result){
                    $('#place').html(result);
                    return false;
                } 
            });
            
        });       
    });
</script>
<div class="info">
<h1 class="font_h1">Danh sách trang</h1>
<?php if(isset($error))  : ?>
<h2 class="error_red"><?php echo $error;?></h2>
<?php endif;?>
<div style="padding: 5px; margin:5px;">
<select name="txt_select" id="txt_select">
   
    <?php foreach($cats as $row):?>
    <option value="<?php echo $row->id_album_cats?>" selected="selected"><?php echo $row->title_cats;?></option>
    <?php endforeach; ?>
</select>
</div>
<div id="place">
<?php $this->load->view('gallery/ajax_photo')?>
</div>
</form>
<a id="delete_all" href="javascript:void()" class="button">Xóa bản tin đã chọn</a>
<a href="<?php echo base_url()?>admin/photo/add_update_cats" class="button">Tạo mới album</a>
<a href="<?php echo base_url()?>admin/photo/list_cats" class="button">Danh sách album</a>
<a href="<?php echo base_url()?>admin/photo/add_update_photo" class="button">Tạo mới hình ảnh</a>
</div>